package com.apache.match.common;

import com.apache.tools.ConfigUtil;
import com.apache.tools.StrUtil;
//import io.goeasy.GoEasy;
//import io.goeasy.publish.GoEasyError;
//import io.goeasy.publish.PublishListener;
import org.apache.log4j.Logger;

/**
 * 消息推送工具类，使用的收费GoEasy第三方插件
 *
 * @author admin 2017-02-08
 */
public class GoEasyUtil {

    private static Logger log = Logger.getLogger(GoEasyUtil.class);

    /**
     * 推送消息到客户端（b/s）
     *
     * @param channelName 栏目名，对应前端
     * @param content 消息内容
     */
    public static void pushGoEasyMsg(String channelName, String content) {
        //检测unity_config.properties中goEasy_push_start参数是否开启推送
//        String goEasy_push_start = ConfigUtil.getInstance().getValueByKey("goEasy_push_start");
//        String goEasy_service_appkey = ConfigUtil.getInstance()
//                .getValueByKey("goEasy_service_appkey");
//        if (StrUtil.isNull(goEasy_push_start)) {
//            goEasy_push_start = "F";
//        }
//        if ("T".equals(goEasy_push_start)) {
//            GoEasy goEasy = new GoEasy(goEasy_service_appkey);
//            log.info("给[" + channelName + "]推送[" + content + "]!");
//            goEasy.publish(channelName, content, new PublishListener() {
//
//                @Override
//                public void onSuccess() {
//                    log.info("行情推送消息成功 ");
//                }
//
//                @Override
//                public void onFailed(GoEasyError error) {
//                    log.info("行情推送消息失败 ,  错误编码：" + error.getCode());
//                }
//            });
//        } else {
//            log.info("【停止行情推送】因检测到unity_config.properties中goEasy_push_start参数未配置值或设置了F ！");
//        }

    }
}
